<!DOCTYPE html>
<html>
  <head>
  	<meta charset="utf-8">
  	<meta name="title" content="{{ page_title }}" />
  	<meta name="author" content="Jason LaPoint" />
  	<title>{{ site_name }} - {{ page_title }}</title>
    <link rel="stylesheet" href="/stylesheets/blueprint/screen.css" type="text/css" media="screen, projection">
	<!--[if lt IE 8]><link rel="stylesheet" href="/stylesheets/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]-->
  	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js" type="text/javascript"></script>
  {% block head %}{% endblock %}
  </head>
  <body>
  <script type="text/javascript">
  	  //For Drop Down Menu
	  var menuitem = 0;
	
	  function menu_open()
	  {  menu_close();
	     menuitem = $(this).find('ul').css('visibility', 'visible');}
	
	  function menu_close()
	  {  if(menuitem) menuitem.css('visibility', 'hidden');}
	
	  $(document).ready(function()
	  {  $('#navbar-menu > li').bind('mouseover', menu_open)
	     $('#navbar-menu > li').bind('mouseout',  menu_close)});
	
	  document.onclick = menu_close;
  </script>
  <div class="container">
    <div class="span-24 last" id="top">
		<div class="span-12">
			<a href="/" ><img src="/images/logo.jpg" alt="Home"/></a>
		</div>
		<div class="span-12 last">
			<div class="topmenu">
		  		{% if admin %}<a href="/admin/home" >Admin</a> | {% endif %}
		  		<a href="{{ url }}">{{ url_link_text }}</a>
		  		<br /> 
		  	</div>
			<div class="topmenu">
				<a href="/user/cart" ><img class="middle" src="/images/cart.png" alt="Cart"/></a>
				<a href="/user/cart" >{% if number_cart_items %}({{ number_cart_items }}){% else %}(0){% endif %} item(s) in cart</a>
			</div>
		</div>
	</div>
	<form action="/search" method="GET">
	<div class="span-24 last" id="navbar">
		<ul id="navbar-menu">
			<li><a href="/" >Home</a></li>  
		 	<li><a href="/tags/" >Products&nbsp;<img class="middle" src="/images/carrot.png"/></a>
		 		<ul>
		 			{% for tag_url, tag_name in tag_dict %} 
		 			<li><a href="/tags/{{ tag_url }}">{{ tag_name }}</a></li>
		 			{% endfor %}
		 		</ul>
		 	</li>
		    <li><a href="/user/home" >My Purchased Products</a></li>
		    {% if admin %}
		    <li><a href="/admin/home" >Admin&nbsp;<img class="middle" src="/images/carrot.png"/></a>
		    	<ul>
		 			<li><a href="/edit?item=product&action=new" >New Product</a></li>
					<li><a href="/edit?item=page&action=new" >New Page</a></li>
					<li><a href="/edit?item=purchase&action=new" >New Purchase</a></li>
					<li><a href="/edit?item=user&action=new" >New User</a></li>
					<li><a href="/admin/home?item=pages" >Pages</a></li>
					<li><a href="/admin/home?item=products" >Products</a></li>
					<li><a href="/admin/home?item=purchases" >Purchases</a></li> 
					<li><a href="/admin/home?item=sessions" >Sessions</a></li>
					<li><a href="/admin/home?item=users" >Users</a></li>
					<li><a href="/admin/flush_memcache" >Clear Memcache</a></li>
		 		</ul>
		 	</li>
		    {% endif %}
		</ul>
		<div id="search">
		<input type="text" name="q" size="40" value="{{ search_string }}">
		<input type="submit" value="Product Search">
		</div>
	</div>
	</form>
	<div class="span-24 last content">
		<hr class="space">
		{% if not no_sidebar %}
			<div class="span-17">
		{% endif %}
				<div class="contentleft">{% block body %}{% endblock %}</div>
		{% if not no_sidebar %}	
			</div>
			<div class="span-7 last">
				<div class="contentright">
					{% block sidebar %}{% endblock %}
					{% if popular_products %}
					<div class="sidebox">
						<div class="sideboxtop">Popular Products</div>
						{% for product in popular_products %}
						<div class="popular-products">
							<div class="popular-products-image"><a href="/products/{{ product.key.id }}/{{ product.title|slugify }}"><img class="middle" src="/images/default_product_icon.png"/></a></div>
							<div class="popular-products-text">
							<ul>
								<li><a href="/products/{{ product.key.id }}/{{ product.title|slugify }}">{{ product.title }}</a></li> 
								<li>Price: ${{ product.price|floatformat:2 }}</li>
								{% if product.tags %}<li>{{ tag_name }}:<ul class="horizontal-list">{% for tag in product.tags %}<li><a href="/tags/{{ tag }}">{{ tag }}</a>{% if not forloop.last %},{% endif %}</li>{% endfor %}</ul></li>{% endif %}
							</ul>
							</div>
						</div>
						{% endfor %}
						<div class="clear"></div>
					</div>
					{% if merchant_id %}
					<div id="googleCheckoutLogo"></div><script src='https://checkout.google.com/buttons/logos?merchant_id={{ merchant_id }}&amp;loc=en_US&amp;f=png' ></script>
					{% endif %}
					<hr class="space">
					<div><img src="http://code.google.com/appengine/images/appengine-noborder-120x30.gif" alt="Powered by Google App Engine" /></div>
					{% endif %}
				</div>
			</div>
		{% endif %}
	</div>
 	<hr class="space">
 	<div class="span-24 last" id="footer">
		<div>Copyright 2009 Jason LaPoint. All Rights Reserved.</div>
		<div><a href="/about" >About</a> | <a href="/contact" >Contact</a> | <a href="/disclaimer" >Disclaimer</a></div>
    </div>
  </div>
  {% if google_analytics_account %}
  <script type="text/javascript">
  var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
  document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
  </script>
  <script type="text/javascript">
  try {
  var pageTracker = _gat._getTracker("{{ google_analytics_account }}");
  pageTracker._trackPageview();
  } catch(err) {}</script>
  {% endif %}
  </body>
</html>
  